import React,{Component} from 'react';

export default class EventDemo extends Component{
    constructor(props){
        super(props)
        this.state = {
            msg:""
        }
    }
    inputChange=(e)=>{
        //console.log("检测到表单的变化");
        //console.log(e.target.value)
        this.setState({
            msg:e.target.value
        })


    };
    getInput=()=>{
        console.log(this.state.msg);
    }

    render(){
        return(
            <div>
                <input onChange={this.inputChange}/><button onClick={this.getInput}>获取表单的值</button>
            </div>
        )
    }
}